package kubayaxi.video.client.controller;

import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import kubayaxi.video.client.service.IFileService;
import kubayaxi.video.service.base.common.response.ResponseResult;
import org.springframework.web.bind.annotation.*;
import org.springframework.web.multipart.MultipartFile;

import javax.annotation.Resource;

@RestController
@RequestMapping("/client/file")
@Api(tags = "客户端【文件】")
public class FileController {

    @Resource
    private IFileService fileService;

    @ApiOperation("视频上传")
    @PostMapping("/videoUpload")
    public ResponseResult videoUpload(@RequestParam("videoFile") MultipartFile videoFile,
                                      Long cId, String title, String desc) throws Exception {
        fileService.videoUpload(videoFile,cId,title,desc);
        return ResponseResult.success();
    }

    @ApiOperation("头像上传")
    @PostMapping("/headUpload")
    public ResponseResult<String> headUpload(@RequestParam("headFile") MultipartFile headFile){
        String ans = fileService.headUpload(headFile);
        return ResponseResult.success(ans);
    }
}
